<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/bpmapp.tld" prefix="ssp" %>

<!-- My process instances block -->
<div class="blocktitle">
  <span class="left">
    <bean:message bundle="appCommonRes" key="bp.processInstance.list.blockTitle" />
  </span>
  <span class="right">&nbsp;</span>
</div> 

<div class="blockWrap">
<table width="100%" class="dataTable" border="0" cellspacing="1" cellpadding="2" summary="My Process Instances">
  <tr class="listHeader"> 
    <th align="left"><bean:message bundle="appCommonRes" key="bp.process.processInstance.instanceName" /></th>
    <th align="left"><bean:message bundle="appCommonRes" key="bp.process.processInstance.processName" /></th>
    <th align="left"><bean:message bundle="appCommonRes" key="bp.process.processInstance.status" /></th>
    <th align="left"><bean:message bundle="appCommonRes" key="bp.process.processInstance.startDate" /></th>
  </tr>

  <ssp:myProcessInstances id="processInstanceList" toScope="page" maxReturn="5"
       sortField="START_DATE" sortOrder="ASC" includeDays="2" inBlockMode="true"/>

  <logic:empty name="processInstanceList">
    <tr class="listOdd">
      <td colspan="4" align="center">
        <bean:message bundle="appCommonRes" key="bp.process.processInstance.no" />      
      </td>
    </tr>  
  </logic:empty>
  
  <logic:iterate id="processInstanceItem" name="processInstanceList" 
                 scope="page" indexId="index">
  <tr class="<%=index.intValue() % 2 == 0 ? "listEven" : "listOdd"%>">
    <td>
      <a href = "<bean:write name='processInstanceItem' property = 'url' />" >
                 <bean:write name="processInstanceItem" property = "name"  /></a>
    </td>

    <td>
      <bean:write name="processInstanceItem" property ="processName" />
    </td>

    <td>
      <bean:write name="processInstanceItem" property="applicationState"/>
    </td>

    <td>
      <bean:write bundle="appCommonRes" name="processInstanceItem" property ="launchDate" formatKey="format.datetime.short"/>
    </td>
                    
  </tr>
  </logic:iterate>

  <logic:notEmpty name="processInstanceList">
    <tr>
      <td colspan="4"><br>
        <html:link page="/allMyProcessInstances.do">
          <bean:message bundle="appCommonRes" key="view.full.details" />
        </html:link>
      </td>
    </tr>
  </logic:notEmpty>
</table>
</div>
<!-- End my process instances block -->  
